package com.tianheng.wanzhou.datacollecting.netty.kongyajiR150.receiver;

import com.baomidou.mybatisplus.extension.service.IService;

/**
 * @Author: yujw
 * @Date: 2020/5/19 11:20
 * @Version 1.0
 */
public abstract class Receiver<T> {
    public abstract T parseMessage(String message, String ip, Integer company, Integer workshop, String machineId);

    public abstract IService<T> getService();

    public void save(String message, String ip, Integer company, Integer workshop, String machineId) {
        T entity = parseMessage(message, ip, company, workshop, machineId);
//        IService service = getService();
        IService<T> service = getService();
        service.saveOrUpdate(entity);
    }

}
